/**
 * 批量增加分销商团队列表初始化
 */
var teamTableWidth = 800; //表格宽度
var teamTableHeight = 500; //表格高度
var teamTablePageSize = 15; //表格默认记录条数
var teamTablePageList = [5,10,15,20,25,30,35,40]; //表格页面记录列表
var teamPageNumber =1;
var teamTableTitle = "分销商团队成员表";
var teamTableURL = getTimeURL("../share/DistributorTeamInfo/queryListByDistributorId.do");
var teamTableQueryParams; //表格请求参数

var teamTableColumns = [ [
		{
			field : 'id',
			title : 'id',
			width : 0,
			rowspan : 1
		},
		{
			field : 'realName',
			title : '真实姓名',
			width : 200,
			align : 'center',
			rowspan : 1
		},
		 {
			field : 'userName',
			title : '昵称',
			width : 200,
			align : 'center',
			rowspan : 1
		}, {
			field : 'mobilePhone',
			title : '手机号',
			width : 100,
			align : 'center',
			rowspan : 1
		}, {
			field : 'shareCode',
			title : '推广码',
			width : 200,
			rowspan : 1
		}
		] ];

/**
 * 装载分销商团队表格第1页数据
 */
function loadTeamPageData(distributorId) {
	var teamToolbarVar;
	teamTableQueryParams = {"distributorId":distributorId,"auditStatus":"1"};
	// datagrid表格
	$('#datagrid_table_team').datagrid({
		title : teamTableTitle,
		iconCls : 'icon-save',
		/*width : tableWidth,*/
		height : teamTableHeight,
		nowrap : false,
		striped : true,	
		url : teamTableURL,
		pageNumber : teamPageNumber, // 指定当前页码为第1页
		remoteSort : true,
		idField : 'id',
		pagination : true, // 支持分页		
		pageSize: teamTablePageSize,
		pageList: teamTablePageList,
		pagePosition:'top',
		queryParams: teamTableQueryParams,
		rownumbers : true, // 显示记录编号
		toolbar : teamToolbarVar,		
		checkOnSelect:true,
		onLoadSuccess : function(data) {
			setTimeout(function() {	
				$("#datagrid_table_team").datagrid("clearSelections");
				$("#datagrid_table_team").datagrid("clearChecked");
				$(".xxl_linkbutton").linkbutton({plain:true});
			}, 10);
		},
		columns : teamTableColumns
	});
	$('#datagrid_table_team').datagrid('hideColumn','id'); //隐藏id字段	
}

//查看团队人员
function queryTeamMembers(distributorId){	
	$('#datagrid_view_team').css("display","block");
	// 打开添加窗口
	$('#datagrid_view_team').window({
		title : "分销商团队成员",
		modal : true,
		width : 830,
		height : 520,
		shadow : false,
		closed : false,
		minimizable : false,
		maximizable : false,
		collapsible : false,
		iconCls : 'icon-add',
		resizable : false,
		top : 50,
		left : ($(window).width() - 830) * 0.5,
		onOpen : function(){
			if(typeof KindEditor != "undefined"){
				editor=KindEditor.create('textarea[class="kindeditor"]', {
				resizeType : 1,
				allowPreviewEmoticons : false,
				uploadJson : '/mrjy_file/common/util/uploadImg.do',
				allowImageUpload : true,
				afterBlur: function(){
					this.sync();
				},
				items : [
					'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
					'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
					'insertunorderedlist', '|', 'emoticons', 'image', 'link']
			});
			}
		},
		onClose: function () {
			// 关闭Dialog前移除编辑器
			  if(typeof KindEditor != "undefined"){
			   KindEditor.remove('.kindeditor');
			  }
		}
	});
	initEvent();
	loadTeamPageData(distributorId);//加载表格数据		
}

 function teamReload() {
	$('#datagrid_table_team').datagrid('load', {});
};

function teamClearForm() {
	
}

function initEvent(){
	
}
